//
//  AudioManager.m
//  GameProject
//
//  Created by Blair Trusler on 16/01/2012.
//  Copyright (c) 2012 Blair Trusler. All rights reserved.
//

#import "GameHeader.h"

@implementation AudioManager

static NSString *MENU_MUSIC = @"menumusic.mp3";                      //http://www.nosoapradio.us/radio/tracks/DST-EndTimes.mp3
static NSString *MENU_BUTTON_CLICK = @"menuConfirm.wav";                //http://www.freesound.org/people/RunnerPack/sounds/87033/ 
static NSString *LEVEL_1_MUSIC = @"DST-MapOfDoom.mp3";                  
static NSString *LEVEL_2_MUSIC = @"DST-DarkestKnight.mp3";                
static NSString *LEVEL_3_MUSIC = @"DST-Darko(Boss).mp3";   
static NSString *LEVEL_4_MUSIC =@"DST-TheDamned.mp3";
static NSString *LEVEL_5_MUSIC =@"DST-MedievalJury.mp3";
static NSString *GAME_OVER_SOUND = @"GameOver.wav";                     //http://www.freesound.org/people/notchfilter/sounds/43698/
static NSString *POWER_UP_SOUND = @"PowerUp.wav";                       //http://www.freesound.org/people/StudioCopsey/sounds/77245/
static NSString *POWER_UP_OVER_SOUND = @"PowerUpOver1.wav";              //http://www.freesound.org/people/leviclaassen/sounds/107789/
static NSString *DOOR_LOCKED = @"locked.wav";
static NSString *COLLISION_SOUND = @"collisionSound.caf";               //Ray Wenderlich 
static NSString *LEVEL_COMPLETE = @"LevelComplete.wav";                 //
static NSString *LEVEL_COMPLETE_MUSIC = @"levelCompleteMusic.wav";      //http://www.freesound.org/people/knarmahfox/sounds/99703/
static NSString *GAME_OVER_MUSIC = @"GameOverMusic.mp3";                //http://www.freesound.org/people/knarmahfox/sounds/72144/

//Preloads audio files in App Delegate on launch
+(void)preloadAudio{
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:MENU_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:LEVEL_1_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:LEVEL_2_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:LEVEL_3_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:LEVEL_4_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:LEVEL_5_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:LEVEL_COMPLETE_MUSIC];
    [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:GAME_OVER_MUSIC];
	[[SimpleAudioEngine sharedEngine] preloadEffect:MENU_BUTTON_CLICK];
    [[SimpleAudioEngine sharedEngine] preloadEffect:GAME_OVER_SOUND];
    [[SimpleAudioEngine sharedEngine] preloadEffect:POWER_UP_SOUND];
    [[SimpleAudioEngine sharedEngine] preloadEffect:POWER_UP_OVER_SOUND];
    [[SimpleAudioEngine sharedEngine] preloadEffect:DOOR_LOCKED];
    [[SimpleAudioEngine sharedEngine] preloadEffect:COLLISION_SOUND];
    [[SimpleAudioEngine sharedEngine] preloadEffect:LEVEL_COMPLETE];
}

//Main menu background music
+(void)playMainMenuMusic{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:MENU_MUSIC loop:YES];
}

//Level 1 Music
+(void)playLevel1Music{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_1_MUSIC loop:YES];
}

//Level 2 Music 
+(void)playLevel2Music{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_2_MUSIC loop:YES];
}

//Level 3 Music
+(void)playLevel3Music{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_3_MUSIC loop:YES];
}

//Level 4 Music
+(void)playLevel4Music{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_4_MUSIC loop:YES];
}

+(void)playLevel5Music{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_5_MUSIC loop:YES];
}

//Level complete music 
+(void)levelCompleteMusic{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_COMPLETE_MUSIC loop:YES];
}

//Game over music
+(void)gameOverMusic{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:GAME_OVER_MUSIC loop:YES];
}

//Button click noise in main menu
+(void)playMenuButtonClick{
    [[SimpleAudioEngine sharedEngine] playEffect:MENU_BUTTON_CLICK];
}

//+(void)levelCompleteMusic{
//    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:LEVEL_3_MUSIC loop:YES];
//}

//Game over effect
+(void)gameOverSound{
    [[SimpleAudioEngine sharedEngine] playEffect:GAME_OVER_SOUND];
}

//Level complete effect
+(void)levelComplete{
    [[SimpleAudioEngine sharedEngine] playEffect:LEVEL_COMPLETE];
}

//Power up effect
+(void)powerUp{
    [[SimpleAudioEngine sharedEngine] playEffect:POWER_UP_SOUND];
}

//Power up expires effect
+(void)powerUpOver{
    [[SimpleAudioEngine sharedEngine] playEffect:POWER_UP_OVER_SOUND];
}

//Collision effect (walls)
+(void)collisionSound{    
    [[SimpleAudioEngine sharedEngine] playEffect:COLLISION_SOUND];
}

//Door locked sound (for level 4)
+(void)doorLockSound{
    [[SimpleAudioEngine sharedEngine] playEffect:DOOR_LOCKED];
}

@end
